function ajax(type,url,data){
    return new Promise (door=>{
        var xhr=new XMLHttpRequest();
    xhr.onreadystatechange=function(){
        if(xhr.readyState==4){
        var result=xhr.responseText
            door(result);
        }
    }
    if(type=="get"&&data!=undefined){
        url+=`?${data}`
    }
    xhr.open(type,url,true)
    xhr.send();
    })
}